/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;
import java.util.List;

/**
 * <p>Project: mybatis202302 - Demo</p>
 * <p>Powered by Administrator On 2023-10-07 09:24:39</p>
 * <p>description: </p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Demo {
    public static void main(String[] args) {
        try(InputStream is = Resources.getResourceAsStream("mybatis-conf.xml")){
            SqlSessionFactory sf = new SqlSessionFactoryBuilder().build(is);
            SqlSession ss = sf.openSession();
            String ver = ss.selectOne("version");
            System.out.println(ver);

            List<String> dbs = ss.selectList("dbs");
            System.out.println(dbs);
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}
